import React, { Component } from 'react'
import List from '../../components/List'
import axios from 'axios'

export class Index extends Component {
  constructor(props) {
    super(props)
  
    this.state = {
       list:[]
    }
  }
  componentDidMount(){
    axios.get('/api/list').then((res)=>{
      this.setState({
        list:res.data
      })
    })
  }
  render() {
    const {list} = this.state
    return (
      <div className='list'>
        <List list={list}></List>
      </div>
    )
  }
}

export default Index